<?php

namespace Modules\Common\Http\Controllers;


use Illuminate\Routing\Controller;

class ApiController extends Controller
{
    /**
     * 返回数据
     */
    public function result($msg="",$success=true,$data=[])
    {
        return response()->json([
            "msg"=>$msg,
            "success"=>$success,
            "data"=>$data
        ]);
    }

    /**
     * 成功返回
     */

    public function prosperity($msg="",$data=[])
    {
        return $this->result($msg,true,$data);
    }

    /**
     * 失败返回
     */
    public function failure($msg="",$data=[])
    {
        return $this->result($msg,false,$data);

    }


}
